//
// Game.hh for nibbler in /home/lefebv_w//workspace/cpp/nibbler/googleCode
// 
// Made by damien lefebvre
// Login   <lefebv_w@epitech.net>
// 
// Started on  Thu Mar 14 21:06:40 2013 damien lefebvre
// Last update Sun Mar 24 18:09:32 2013 damien lefebvre
//

#ifndef		__GAME_HH__
#define		__GAME_HH__

#include	<iostream>
#include	<string>

#include	"header.hh"
#include	"IGraphicLibrary.hh"
#include	"Case.hh"
#include	"Snake.hh"
#include	"BonusPart.hh"
#include	"Bonus5Part.hh"
#include	"IBonus.hh"
#include	"Score.hh"
#include	"BonusManager.hh"

class		Game
{
  #define	CHAR_WALL			'#'
  #define	CHAR_EMPTY			' '

  #define	TIME_SLEEP			20000

private :
  IGraphicLibrary &				m_graph;
  unsigned int					m_size_x;
  unsigned int					m_size_y;
  t_frame					m_frame;
  Snake						m_snake;
  Score						m_score;
  bool						m_endOfGame;
  bool						m_quit;
  bool						m_pause;
  BonusManager					m_bonus;
  std::vector< std::vector<Case *> >		m_map;

public :
  Game(IGraphicLibrary & graph, std::vector< std::vector<char> > const & map);
  Game(IGraphicLibrary & graph, unsigned int size_x, unsigned int size_y);
  ~Game(void);

  void		play(void);

private :
  void		creatGameMap(std::vector< std::vector<char> > const & map);

  void		checkEvent(void);
  void		moveGame(void);
  void		checkEndOfGame(void);
  void		display(void);
  void		timePause(void);
};

#endif
